package com.designpattern.demo.design3;

import com.designpattern.demo.R;
import com.designpattern.demo.ui.BaseActivity;

/**
 * 装饰者模式
 * Created by lingchen on 2019/11/27. 22:37
 * mail:lingchen52@foxmail.com
 */
public class DecoratorActivity extends BaseActivity {

    @Override
    protected int getContentResId() {
        return R.layout.activity_decorator;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        ConcreteComponent concreteComponent = new ConcreteComponent();
        ConcreteDecoratorA decoratorA = new ConcreteDecoratorA();
        ConcreteDecoratorB decoratorB = new ConcreteDecoratorB();
        decoratorA.setComponent(concreteComponent);
        decoratorB.setComponent(decoratorA);
        decoratorB.Opeartion();

        Person person = new Person("小张");
        TShirts tShirts = new TShirts();
        BigTrouser bigTrouser=new BigTrouser();
        tShirts.setComponent(person);
        bigTrouser.setComponent(tShirts);
        bigTrouser.show();
    }
}
